<?php

namespace app\admin\model\sales;

use think\Model;

/**
 * Custbranch
 */
class Custbranch extends Model
{
    // 表名
    protected $name = 'sales_custbranch';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;


    public function debtornoTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Debtorsmaster::class, 'debtorno', 'debtorno');
    }

    public function areaTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Areas::class, 'area', 'areacode');
    }

    public function salesmanTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Salesman::class, 'salesman', 'salesmancode');
    }

    public function defaultlocationTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\stock\Locations::class, 'defaultlocation', 'loccode');
    }

    public function taxgroupidTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\setup\Taxgroups::class, 'taxgroupid', 'taxgroupid');
    }

    public function defaultshipviaTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Shippers::class, 'defaultshipvia', 'shipper_id');
    }
}